import React from 'react'
import {HashRouter, Route, Router, Switch,Redirect} from 'react-router-dom'
import Login from '../views/Login/Login'
import NewsSandBox from '../views/NewsSandBox/NewsSandBox'
export default function indexRouter() {
    
  return (
        <HashRouter>
            <Switch>
                <Route path="/login" component={Login}></Route>
                <Route path="/" render={()=>{
                    localStorage.getItem("token") ? <NewsSandBox></NewsSandBox>:<Redirect to="/login"/>
                }}></Route>
            </Switch>
            
        </HashRouter>
  )
}
